package com.zhl.spark.core.acc

import com.zhl.spark.core.BasicRdd

/**
 * @program: demos
 * @description: ${description}
 * @author: 刘振华
 * @create: 2020-12-14 18:08
 **/
object AccDemo extends BasicRdd{

    def main(args: Array[String]): Unit = {
        test()
    }

    override def logic(): Unit = {
        val sumAcc = sc.longAccumulator("sum")
        sc.makeRDD(List(1,2,3,4)).foreach(sumAcc.add(_))
        println(sumAcc.value)
    }
}
